package com.glacier.cloud.cart.service.impl;

import com.glacier.cloud.cart.dao.CartItemMapper;
import com.glacier.cloud.cart.entity.dto.cmd.CartRemoveCmd;
import com.glacier.cloud.cart.service.CartItemService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * date 2024-01-04 11:25
 *
 * @author glacier
 * @version 1.0
 */
@Transactional(readOnly = true)
@Service
public class CartItemServiceImpl implements CartItemService {
    @Resource
    private CartItemMapper cartItemMapper;

    @Transactional(rollbackFor = {Exception.class})
    @Override
    public int removeCart(CartRemoveCmd cartRemoveCmd) {
//        int i = 1 / 0;
        return cartItemMapper.deleteByUserIdAndProductIds(cartRemoveCmd);
    }
}
